<template>
  <div class="all">
    <div
      class="modalback"
      id="modalback"
      @click="closeModal();"
      style="display: none"
    ></div>
    <div
      class="modal-close"
      id="modal-close"
      @click="closeModal();"
      style="visibility: hidden; display: none"
    >
      <i class="fas fa-times"></i>
    </div>
    <div
      class="modal animated faster zoomOut"
      id="modal"
      style="visibility: visible; z-index: -50"
    >
      <div id="modalx" class="modal-x" @click="closeModal();" v-show="this.isshowModel">
        <i class="fas fa-times"></i>
      </div>
      <div class="modal-inner" id="modalinner">
        <div class="modal_login_inner" v-show="this.isshowModel">
          <div class="modal-header">登录</div>
          <div class="modal_login_newto1x">
            新用户? &nbsp;<span class="link" @click="modal('signup');">加入</span>
          </div>
          <div class="modal-login-field">
            <input type="hidden" id="login_resume" value="" /><input
              type="text"
              class="modal-login-field"
              placeholder="E-mail"
              id="login_email"
            />
          </div>
          <div class="modal-login-field">
            <input
              type="password"
              class="modal-login-field"
              placeholder="Password"
              id="login_password"
            />
          </div>
          <div class="modal_login_buttons">
            <div class="button_black" @click="login();">登录</div>
          </div>
          <div
            class="modal-login-forgotpassword"
            @click="location.href='https://gamma.1x.com/forgot';"
          >
            忘记密码?
          </div>
        </div>
      </div>
    </div>
    <div class="modal animated faster zoomOut" id="modal2" style="z-index: -50">
      <div id="modalx2" class="modal-x" @click="closeModal2();">
        <i class="fas fa-times"></i>
      </div>
      <div class="modal-inner" id="modalinner2"></div>
    </div>

    <rightlinks ref='comR'> </rightlinks>
    <Main v-show="isshow"  ></Main>
    <photo v-show="!isshow"   ></photo>
   
  </div>
</template>

<script>
import rightlinks from "./rightlinks";
import Main from "./Main";
import photo from "./photo";

export default {
  components: {
    rightlinks,
    photo,
    Main,
  },
  data() {
    return {
      isshowModel:false,
      isshow: true,
    };
  },
  watch:{
    $route(to,from){
      console.log(from.path);//从哪来
      console.log(to.path);//到哪去
      if (to.path=='/') this.isshow=true 
    }
},
  mounted() {
    //alert(process.env.VUE_APP_URL) //演示不同环境切换app——rul
    let temurl = window.location.href;
    if (temurl.indexOf("photo") < 0) this.isshow = true;
    else this.isshow = false;
  },
  methods: {
    
    closeModal(){
        
        this.$refs.comR.closeModal()
        this.isshowModel=false
    },
    closeModal2(){
        this.$refs.comR.closeModal2()
        this.isshowModel=false
    },
    ref() {
      // console.log(
      //  document.getElementById('mobsf').contentWindow.history.back();//
      //document.getElementById('mobsf').contentWindow.location.href="http://localhost:8080/#/views/newg"
    },
  },
};
</script>
